package com.xianye.erp.factory;

import java.util.Date;
import java.util.Map;

import javax.annotation.Resource;

import com.xianye.erp.bean.Store;
import com.xianye.erp.dao.base.DaoSupport;
import com.xianye.erp.util.PageData;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component("apiFacadeFactory")
public class ApiFacadeFactory {
	@Resource(name = "daoSupport")
	private DaoSupport dao;
	@Autowired
	private ApiFacade apiFacade;
	public  ApiFacade createFacadeByStore(Object ID){
		try {
			PageData pd = new PageData();
			pd.put("ID", ID);
			PageData store = (PageData) dao.findForObject("StoreMapper.findByID", pd);
			if(store!=null){
				apiFacade.setSessionKey(store.getString("access_token"));
				return apiFacade;
			}
			return null;
			//return apiFacade;
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}
		
	}
}
